<template>
  <div>
    <van-field label="标题" v-model="form.title"/>
    消息类型
    <select  v-model="form.news_type">
      <option value="1">系统消息</option>
      <option value="2">通知公告</option>
    </select>
    <br/>
    优先级
    <select v-model="form.level">
      <option value="1">高级</option>
      <option value="2">中级</option>
      <option value="3">低级</option>
    </select>
    <br/>
    通知类型
    <select @change="changetype" v-model="form.type">
      <option value="1">所有用户</option>
      <option value="2">选择角色</option>
      <option value="3">选择用户</option>
    </select>
    <el-dialog v-model="dialogTableVisible" title="Shipping address">
      <user_bu @setids="getid"></user_bu>
    </el-dialog>
    <br/>
    内容 <teds v-model="content" />
    <van-button @click="submit">提交</van-button>
  </div>
</template>

<script>
import ted from './TEditor'
import myaxios from "axios";
import user_bu from "@/components/user_bu";
export default {
name: "213",
  data(){
   return{
     content:"",
     form:{'content':'', 'userids':''},
     dialogTableVisible:false,
     data: [],
     defaultProps: {
       children: 'children',
       label: 'name'
     }

   }
  },
  components:{
    "teds":ted,
    "user_bu":user_bu
  },
  methods:{
    changetype(){
      if (this.form.type == 2 || this.form.type == 3){
        this.dialogTableVisible = true
      }

    },
    getid(values){
      this.checkdvalues = values
    },

    submit(){
      this.form.content = this.content
      this.form.userids = this.checkdvalues
      myaxios({url:'http://127.0.0.1:5000/noticem', method:'post', data:this.form}).then(res=>{
        console.log(res.data)
      })
    }

  }
}
</script>

<style scoped>

</style>